package Aleehot100;

import java.util.TreeSet;

/**
 * ClassName: c038
 * Package: Aleehot100
 * Description:
 *
 * @Author BCXJ
 * @Create 2025/7/6 12:43
 * @Version 1.0
 * @Since 1.0
 */
public class c038 {
    public static void main(String[] args) {

    }
    static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode() {
        }

        TreeNode(int val) {
            this.val = val;
        }

        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }


    public TreeNode invertTree(TreeNode root) {
        if(root == null) {
            return null;
        }
        TreeNode left = invertTree(root.left);
        TreeNode right = invertTree(root.right);
        root.right = left;
        root.left = right;
        return root;
    }
}
